home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / dev / misc / BoulderEngine.lha / source / snaige.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-30  |  913 b   |  56 lines

  1. #include "GRAFKERNEL.C"
  2. #include "JOYSTICK.C"
  3. #include <math.h>
  4. #include <libraries/mathffp.h>
  5.  
  6. static float alpha=0,pi=3.1415926;
  7. static long x=320,y=200;
  8. int MathTransBase,MathBase;
  9. posukis(m)
  10. float m;
  11. {
  12. alpha=alpha+m;
  13. if(alpha>2*pi) {alpha=alpha-pi-pi; }
  14. }
  15. judek(a)
  16. float a;
  17. {
  18.  x=x+(int)(a*SPSin(alpha)); if(x>640) {x=639;}
  19.  y=y+(int)(a*SPCos(alpha)); if(y>400) {y=399;}
  20. }
  21. snaige(a,k,m)
  22. float a;
  23. long k,m;
  24. {
  25.  long i;
  26.  for(i=1;i<6;i++)
  27.  {
  28.   Move(&rastport,x,y);
  29.   posukis(pi*2/3);
  30.   judek(a);
  31.   Draw(&rastport,x,y);
  32.   judek(a/k);
  33.   if(m>1) { snaige(a/k,k,m-1); }
  34.   judek(-a/k);
  35.   posukis(pi);
  36.   judek(a);
  37.  }
  38. }
  39.  
  40. main()
  41. {
  42. if((MathTransBase=OpenLibrary("mathtrans.library",0))<1)
  43. exit(-1);
  44. if((MathBase=OpenLibrary("mathffp.library",0))<1) exit(-1);
  45. pasiruosk();
  46. SetRast(&rastport,0L);
  47. SetAPen(&rastport,1L);
  48. snaige(4,2,3);
  49. while(!fire()) { }
  50. FreeMemory();
  51. CloseLibrary(MathTransBase);
  52. CloseLibrary(MathBase);
  53. }
  54.  
  55.  
  56.